import React from "react";
import { createFromIconfontCN } from "@ant-design/icons";

export default (props) => {
  const { antd = false, type, ...otherProps } = props;
  const IconFonts = createFromIconfontCN({
    scriptUrl: ["/static/js/aliFont.js"]
  });
  if (antd) {
    const Icons = require("@ant-design/icons")[type];
    return <Icons type={type} {...otherProps} />;
  } else {
    return <IconFonts type={type} {...otherProps} />;
  }
};

